# Semantic Layer Sync with Preset

This page details the support for [Preset](https://preset.io)
in [Semantic Layer Sync](/product/apis-integrations/semantic-layer-sync).

## Configuration

To create a new sync, choose <Btn>Preset</Btn>:

<Screenshot
  highlight="inset(34% 65% 55% 20% round 10px)"
  src="https://ucarecdn.com/36c23111-871d-4d2a-927f-877df954b090/"
/>

Data model is synchronized via [Preset API][preset-api] which uses API keys for
authentication.

You can generate a new API key in your [user
settings][preset-user-settings] in Preset to obtain an `api_token` and an
`api_secret`. You can also copy a `workspace_url` at any page of your Preset
workspace. Note that your use should have the [workspace
role][preset-user-roles] of `Workspace Admin`.

Example confguration for Preset:

<CodeTabs>

```python
from cube import config

@config('semantic_layer_sync')
def semantic_layer_sync(ctx: dict) -> list[dict]:
  return [
    {
      'type': 'preset',
      'name': "Preset Sync",
      'config': {
        'api_token': '07988f63-c200-499e-97c9-ba137d8918aa',
        'api_secret': 'c19fbab4fd4945899795d32898f2e1165bef8e5ee653499e92f083b3d088aecb',
        'workspace_url': '12345678.us1a.app.preset.io',
        'database': 'Cube Cloud: production-deployment'
      }
    }
  ]
```

```javascript
module.exports = {
  semanticLayerSync: ({ securityContext }) => {
    return [
      {
        type: "preset",
        name: "Preset Sync",
        config: {
          api_token: "07988f63-c200-499e-97c9-ba137d8918aa",
          api_secret: "c19fbab4fd4945899795d32898f2e1165bef8e5ee653499e92f083b3d088aecb",
          workspace_url: "12345678.us1a.app.preset.io",
          database: "Cube Cloud: production-deployment"
        }
      }
    ]
  }
}
```

</CodeTabs>


[preset-api]: https://api-docs.preset.io
[preset-user-settings]: https://manage.app.preset.io/app/user
[preset-user-roles]: https://docs.preset.io/docs/role-based-access-security-rbac#change-user-access-to-a-workspace